package com.xja.security.service.impl;

import com.xja.security.entity.Admin;
import com.xja.security.service.AdminService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName AdminServiceImpl
 * @Description
 * @Author MaYu
 * @Date 2022/4/12 14:45
 * @Version 1.0
 **/
@Service
public class AdminServiceImpl implements AdminService {

    List<Admin> adminList = new ArrayList<>();
    public AdminServiceImpl(){
        adminList.add(new Admin(1, "zhangsan", "123456", "北京"));
        adminList.add(new Admin(2, "lisi", "123456", "河北"));
        adminList.add(new Admin(3, "zhuge", "123456", "山东"));
        adminList.add(new Admin(4, "wangye", "123456", "武当"));
    }
    @Override
    public Admin login(String aName) {
        for (Admin admin : adminList) {
            if (admin.getaName().equals(aName)){
                return admin;
            }
        }
        return null;
    }
}
